import 'package:flutter/material.dart';
import 'package:whale/helper/utils/media_picker.dart';

import '../../../helper/global/user/logic.dart';
import '../../../helper/utils/util.dart';
import '../index.dart';

class PersonCard extends GetView<MeController> {
  const PersonCard({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var user = UserController().state.userObs;
    return Obx(
      () => InkWell(
        onTap: controller.goLogin,
        child: Container(
          child: Row(children: [
            InkWell(
              onTap: () {
                MediaPicker.pickImages();
              },
              child: ImageLoadEx.avater(user.value.headUrl,
                  sex: user.value.gender, size: 70.r),
            ),
            SizedBox(
              width: 10.r,
            ),
            UserController().isLogin
                ? Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        user.value.userName ?? '~~',
                        style: TextStyle(
                            color: const Color(0xff333333), fontSize: 22.sp),
                      ),
                      Text(
                        user.value.userOrgPostDtoList?.first.orgName ?? '~~',
                        style: TextStyle(
                            color: const Color(0xff999999), fontSize: 14.sp),
                      ),
                    ],
                  )
                : Text(
                    '登录'.ls,
                    style: TextStyle(
                        color: const Color(0xff333333), fontSize: 22.sp),
                  ),
          ]),
        ),
      ),
    );
  }
}
